import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
  path: '/',
  name: 'layout',
  component: () => import( /* webpackChunkName: "layout" */ '@/views/layout/index.vue'),
  children: [{
    path: '/home',
    name: 'home',
    component: () => import( /* webpackChunkName: "home" */ '@/views/home/index.vue'),
  }, {
    path: '/find',
    name: 'find',
    component: () => import( /* webpackChunkName: "find" */ '@/views/find/index.vue'),
  }, {
    path: '/car',
    name: 'car',
    component: () => import( /* webpackChunkName: "car" */ '@/views/car/index.vue'),
  }, {
    path: '/my',
    name: 'my',
    component: () => import( /* webpackChunkName: "my" */ '@/views/my/index.vue'),
  }, {
    path: '/',
    redirect: '/home'
  }]
}, {
  path: '/post/:id',
  name: 'detail',
  component: () => import( /* webpackChunkName: "detail" */ '@/views/detail/index.vue')
}]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router